About oauth url generator
OAuth 2.0 lets an app ask for limited access to a user's account without seeing their password. The first step is an authorization URL that sends the user to the provider.
Parameters
- client_id: identifies your app.
- redirect_uri: where the provider sends the user back. It must match exactly what you registered.
- scope: the permissions you are requesting; ask only for what you need.
- state: a random value you check on return to stop forged requests.
- code_challenge (PKCE): protects the code exchange, recommended for mobile and single-page apps.
Security reminders
Verify the state value when the user returns, use PKCE for public clients, and keep client secrets on the server only.
A worked example
A web app builds https://provider.example/authorize?response_type=code&client_id=APP&redirect_uri=https%3A%2F%2Fapp.example%2Fcallback&scope=profile&state=RANDOM&code_challenge=HASH&code_challenge_method=S256. The user signs in at the provider and is sent back to the callback with a code.
PKCE in short
- The app creates a random code_verifier of 43 to 128 characters.
- It sends the S256 hash of it as the code_challenge.
- It sends the verifier when exchanging the code, which proves it started the request.
