magic-link | Generate , send and validate a magic link | Proxy library
kandi X-RAY | magic-link Summary
kandi X-RAY | magic-link Summary
This is the second edition of #umaStackQueNaoDomino. Python Edition. The project offer API to generate, send and validate a magic link.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Verify the JWT signature .
- Validate a JWT token .
- Enqueue a magic link .
magic-link Key Features
magic-link Examples and Code Snippets
Community Discussions
Trending Discussions on magic-link
QUESTION
I am attempting to set up a Magic link like system using Azure B2C. Using the following samples:
Primary:
https://github.com/azure-ad-b2c/samples/tree/master/policies/sign-in-with-magic-link
For sing B2C to generate the metadata endpoints: https://github.com/azure-ad-b2c/samples/tree/master/policies/invite#using-b2c-to-generate-the-metadata-endpoints
As a note I believe I had it working at one point but after a clean up I have been getting the error:
The provided id_token_hint parameter failed signature validation. Please provide another token and try again.
The steps I took to set up is as follows:
- Create a cert via powershell and get thumbprint to use in local code
- Use certmng via MMC to export cert
- All Task / Export / Next / Yes, Export the private key
- Personal Information Exchange - PKCS (Include all cert in cert path)(Enable cert privacy)
- Security (Password) Randomly Generated Pass 25 character password.
- Name: id_token_hint_cert.pfx
- Browse Azure / B2C / Identity Experience Framework / Policy keys
- Add / Option: Upload / Name: IdTokenHintCert / File Upload id_token_hint_cert.pfx / Password: Password from setup 3
This is where I have tried 2 different set ups. The first was to setup a set of custom policies so that I could update the following claims provider to have issuer_secret set to B2C_1A_IdTokenHintCert
...ANSWER
Answered 2021-Nov-09 at 16:25Location Location Location.
I was adjusting the base profile which I learned I should not be doing. When I applied my change to the extension file instead everything starting working properly.
QUESTION
I'm looking for a method to log in a user using a link sent by mail. The Sign-in with a magic link sample policy comes very close to what I want to achieve.
My main issue with this sample is that it requires the web app to set up a certificate and host an OIDC endpoint. So the web app becomes the source of trust. What even is the point of B2C if it's not generating or validating the tokens? It seems like I'm adding an extra attack surface on our application. One of the reasons we use B2C is so we don't have to deal with the dangers of authenication. Or am I seeing this wrong?
Another option I was looking at is the OAuth 2.0 On-Behalf-Of flow. That does use B2C as the source of trust but is not intended to create user tokens. It's for authenticating one app with the parent app. Would it be a bad idea to try to use such an OBO access token to authenticate a user instead?
...ANSWER
Answered 2020-Mar-24 at 13:10Your solution is in the link you posted. You can give the certificate to B2C and we can host that metadata.
To note, when using id_token_hint, you are the IDP and giving Azure AD B2C the hint. Hence you need to have a metadata endpoint. B2C can host it for you if you use the above link, but you are sharing with us the Private Key, and you may not want to do that since as an IdP you dont share your private keys.....
QUESTION
I have the following flow for sign in / sign up, when using sign-up:
- Present user with sign up screen, allow them to enter email/password/name
- Validate input, then send email (rest api) and set verification attributes in b2c custom extension properties
User then receives email with verification link
- User clicks link from email and gets sent to a new user journey for the return trip
- New user journey gets parameters from the querystring (email + verif code)
- B2C validates the verif code + expiry
- IF user is verified, they're set as verified via custom extension attributes, then sent to the (ASP.NET MVC) application.
- Here's where I'm stuck - B2C is sending the jwt token back to the app, but the user doesn't get 'signed-in'.
Am I missing something at step 7? I don't have the "state" variable in my querystring, am I expected to build and include it somehow so that B2C and the app can communicate? I'm lost at this point. I'd post some of the b2c policy xml but not sure what would even help...
EDIT: reply to Jas:
Is that the only way (make an app call b2c for an auth request)? We have multiple apps that a user can use to sign up through b2c, so I was hoping to avoid having to make changes to each of them. Instead I was hoping that B2C could tell the app after account verification that "this user is ok".
I did previous look at https://github.com/azure-ad-b2c/samples/tree/master/policies/sign-in-with-magic-link (written by you!), but again, was hoping I could avoid having to do that work inside of each of our apps.
Here's an example of the jwt 'id_token' I'm trying to pass to the app:
Side note: Is 'id_token' the same as 'id_token_hint'? I couldn't find whether they're the same or different when googling it.
...ANSWER
Answered 2020-Feb-11 at 21:42What you need to do is send the invite link in the email as a link to the app, eg https://myapp.com?id_token_hint=value. Then have your apps account controller make an auth request to the policy to complete the account redemption along with an extra query parameter “id_token_hint=value”. Now a proper auth can happen with your applications openId middleware initialised.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install magic-link
You can use magic-link like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page