Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

This course is the most refreshing take on teaching design that I've come across.

— Mikaël Sévigny, Developer

OAuth Tag

If you're using OAuth to manage user authentication, you may find you need to generate login URLs at some point. Here's how you do it.

Examples

Here's the regular/parameter syntax in action, especially useful if the provider name comes from variable.

<a href="{{ oauth provider="github" }}">Sign In with Github</a>
<a href="{{ Statamic::tag('oauth')->provider('github') }}">Sign In with Github</a>
<a href="/oauth/github">Sign In with Github</a>

And the shorthand version.

<a href="{{ oauth:github }}">Sign In with Github</a>
<a href="{{ Statamic::tag('oauth:github') }}">Sign In with Github</a>
<a href="/oauth/github">Sign In with Github</a>

And now with a redirect:

<a href="{{ oauth:github redirect="/account" }}">Sign In with Github</a>
<a href="{{ Statamic::tag('oauth:github')->redirect('/account') }}">Sign In with Github</a>
<a href="/oauth/github?redirect=/account">Sign In with Github</a>

Parameters

provider

string|tagpart

The provider to be used. You may either specify as a parameter or as a tagpart for shorthand: {{ oauth provider="github" }} or {{ oauth:github }}

redirect

string

The URL to be taken to after authenticating. This will be appending onto the generated URL as a query parameter.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →