Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  1. Fotoware Alto
    • 11.14 Schreckhorn
    • Terminology
    • Solutions
    • User Guide - Deutsch
    • User Guide - English
    • API Changelog
  2. Fotoware Veloz
    • Managing users and groups
    • Configuring archives
    • Configuring workflows
    • Configuring site behavior
    • Navigating and searching to find your assets
    • Working with your assets
    • Editing asset metadata
    • Uploading files
    • Version Control in Fotoware
    • Albums - Creating and sharing collections
    • Placing assets in a CMS
    • Working with the Fotoware Pro interface
    • Using the Fotoware plugins
    • Consent management
    • User guide to FotoWeb for iPad (Legacy)
    • Picture conferencing with FotoWeb Screens (Legacy)
    • What's what in Fotoware
    • GDPR
    • Fotoware Veloz releases
    • Activity Exports
    • Fotoware Example Workflows
  3. Fotostation
    • Getting started with Fotostation
    • Viewing, selecting and sorting files
    • Managing your assets with archives
    • Adding metadata to assets
    • Searching for assets
    • Working with your assets
    • Version Control in Fotostation
    • Automating tasks with Actions
    • Configuring metadata fields and editors
    • Configuring Fotostation
    • Configuring Fotostation for multi-user environments
    • Troubleshooting Fotostation
  4. Fotoware Flow
    • What is Flow?
    • Getting started
    • Flow dictionary
  5. Fotoware On-Premises
    • Getting started
    • Index Manager
    • FotoWeb
    • Color Factory
    • Connect
    • Operations Center Guide
  6. Integrations and APIs
    • The Fotoware API
    • Creating integrations using embeddable widgets
    • Authorizing applications using OAuth
    • Auto-tagging
    • FotoWeb Drag and Drop export
    • Integration using webhooks
    • Optimizely and Episerver plugin documentation
    • User Interface Integrations
  7. Fotoware Mobile
    • User guide for Fotoware Mobile for iPhone and Android
    • User guide to FotoWeb for iPad (Legacy)
    • User guide to FotoWeb for iPhone and Android (Legacy)

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Support

Table of Contents

Protocol flow Implementation in JavaScript What's next?
  • Home
  • Integrations and APIs
  • Authorizing applications using OAuth

Authorization using implicit grant (deprecated)

How to authorize applications using implicit grant.

01. April 2025

Elaine Foley

Table of Contents

Protocol flow Implementation in JavaScript What's next?

Note: Implicit grant is deprecated in OAuth 2.1

For information about how to register the application, see application registration. 

Protocol flow

The client opens a browser window to the following URL (line breaks are added for readability. All parameter values must be URL-encoded):

https://myfotowebserver.com/fotoweb/oauth2/authorize?
 response_type=token&
 client_id=CLIENT_ID&
 redirect_uri=REDIRECT_URI&
 state=STATE

where

Parameter Description
response_type Mandatory. Must always be token.
client_id Mandatory. The unique ID of the client, which was obtained during client registration.
redirect_uri

The redirection endpoint URI of the client.

If given, it must match one of the redirection endpoint URIs registered for the client.

Optional if the application only has one registration endpoint.

Mandatory if the application has more than one registration endpoint.

state Mandatory: This should be a unique, cryptographically safe random string.

This request may result in the user being shown a login prompt for FotoWeb.

Upon success, the server responds by redirecting the user to the client's redirection endpoint URI. This is always one of the redirection endpoints registered for the client and if given, the redirection URI passed in the request as redirect_uri.

Parameters are added to the fragment part of the redirection URI as follows (line breaks added for readability. All parameter values are URL-encoded):

https://myapplication.com/oauth2/callback#
 access_token=ACCESS_TOKEN&
 token_type=bearer&
 expires_in=EXPIRES_IN_SECONDS
 state=STATE

where

Parameter Description
access_token The access token that is used to authorize requests to the FotoWeb API
token_type This is always bearer.
expires_in Number of seconds after which the token is expected to expire.
state The exact value of the state parameter sent by the client in the authorize request.
The client MUST check that this value is identical to the value it sent earlier to protect against cross-site request forgery (CSRF) attacks. If the values do not match, the client MUST reject the request. This can be done, for example, by showing an error page. The client MUST NOT proceed with the authorization process and SHOULD NOT do anything that can affect its state other than logging.
The client MAY also use this value to identify an individual session and/or authorization process (and in that case, reject the request if no session with a matching ID is found).

The application can obtain the access token by parsing the fragment part of the redirection URL.

The server will not issue a refresh token if implicit grant is used. When the access token has expired, the only way to obtain a new access token is to repeat authorization.

Implementation in JavaScript

01 function createState()
02 {
03 		var text = "";
04 		var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_~.";
05 		for (var i = 0; i < 16; ++i)
06 		text += possible.charAt(Math.floor(Math.random() * possible.length));
07
08
09 		return text;
10 }
11
12
13 function requestAuthorization(tenantURL, clientID, redirectURI)
14 {
15		var state = createState();
16 		sessionStorage.setItem('state', state);
17
18
19 		window.location = tenantURL + "/fotoweb/oauth2/authorize?" +
20 			"response_type=token&" +
21 			"client_id=" + clientID + "&" +
22 			"redirect_uri=" + encodeURIComponent(redirectURI) + "&" +
23 			"state=" + encodeURIComponent(state);
24 }
25
26
27 function getAccessToken()
28 {
29 		var state = sessionStorage.getItem('state');
30 		if (state === null) return null;
31
32
33 		var params = window.location.hash.substring(1).split('&');
34 		var token = null;
35 		var stateValid = false;
36 		for (var i = 0; i < params.length; ++i)
37 		{
38 			var pair = params[i].split('=');
39 			if (decodeURIComponent(pair[0]) === 'access_token')
40 			{
41 				token = decodeURIComponent(pair[1]);
42			}
43 			else if (decodeURIComponent(pair[0]) === 'state') {
44 				if (state === decodeURIComponent(pair[1]))
45 					stateValid = true;
46 				else
47 					alert("Invalid state! Someone is trying to mess with you!")
48 			}
49 		}
50
51
52 		if (stateValid)
53 			return token;
54
55
56 		return null;
57 }

The following JavaScript functions can be used to implement OAuth 2.0 in a single-page application:

The requestAuthorization function redirects the user to the authorization endpoint of FotoWeb. It may be called, for example, when the user selects a Log in with FotoWeb button. The parameters are as follows:

  • tenantURL is the URL of the FotoWeb server, e.g., https://acme.fotoware.cloud.
  • clientID is the client ID of the registered application.
  • redirectURI is the absolute URL of the endpoint of the application which receives the access token, e.g., https://apps.acme.org/oauth2/callback.

The getAccessToken function reads the access token from the fragment part of the URL after authorization is successful.

This implementation validates the OAuth 2.0 state parameter by creating a random value before the authorization process and passing it to the getAccessToken function using session storage.

This prevents cross-site request forgery (CSRF) and embedding the app into other apps (mash-ups) by ensuring that the app only accepts access tokens it has itself requested.

Any additional parameters to the application may be passed through the authorization process in session storage.

What's next? 

To learn how to use OAuth access tokens in your configuration, see Using application access tokens for OAuth 2.0 authorization.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Authorizing a client using OAuth 2.0
  • Using application access tokens for OAuth 2.0 authorization
  • Good practice for requesting access tokens
eco-lighthouse-miljøfyrtårn

Company

  • About us
  • Resellers
  • Careers
  • Contact us

Help & support

  • Support center
  • Consultancy
  • Tech partners
  • Fotostation
  • System status

Trust Center

  • Legal
  • Security
  • Sustainability & ESG

Locations

Fotoware AS (HQ)
Tollbugata 35
0157 OSLO
Norway
FotoWare Switzerland AG
Industriestrasse 25
5033 Buchs (AG)
Switzerland

Copyright 2025 Fotoware All rights reserved.

  • Terms of service
  • Privacy policy
  • Cookie policy

Knowledge Base Software powered by Helpjuice

Expand