Public
Versions
- Open: VersionChanges from v7 to v8+2-2import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";
import type { Context } from "npm:hono";/**⦚ 4 unchanged lines ⦚options: IOAuth2Options,c: Context,) {const { portal, clientId, expiration, redirectUri, state }: IOAuth2Options = {...{ portal: "https://arcgis.com/sharing/rest", expiration: 20160 },⦚ 167 unchanged lines ⦚import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";import type { Context, TypedResponse } from "npm:hono";/**⦚ 4 unchanged lines ⦚options: IOAuth2Options,c: Context,): TypedResponse<unknown, 301, "redirect"> {const { portal, clientId, expiration, redirectUri, state }: IOAuth2Options = {...{ portal: "https://arcgis.com/sharing/rest", expiration: 20160 },⦚ 167 unchanged lines ⦚ - Open: VersionChanges from v6 to v7+1-1⦚ 27 unchanged lines ⦚const url = `${portal}/oauth2/authorize?${encodeQueryString(queryParams)}`;
c.redirect(url);}⦚ 148 unchanged lines ⦚⦚ 27 unchanged lines ⦚const url = `${portal}/oauth2/authorize?${encodeQueryString(queryParams)}`;return c.redirect(url, 301);}⦚ 148 unchanged lines ⦚ - Open: VersionChanges from v5 to v6+149-1import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";
import { encodeQueryString } from "npm:@esri/arcgis-rest-request/dist/esm/utils/encode-query-string.js";import type { Context } from "npm:hono";/**⦚ 24 unchanged lines ⦚c.redirect(url);}import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";import type { Context } from "npm:hono";/**⦚ 24 unchanged lines ⦚c.redirect(url);}/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.* Apache-2.0 *//*** Encodes keys and parameters for use in a URL's query string.** @param key Parameter's key* @param value Parameter's value* @returns Query string with key and value pairs separated by "&"*/export function encodeParam(key: string, value: any): string {// For array of arrays, repeat key=value for each element of containing arrayif (Array.isArray(value) && value[0] && Array.isArray(value[0])) {return value.map((arrayElem: string) => encodeParam(key, arrayElem)).join("&");}return encodeURIComponent(key) + "=" + encodeURIComponent(value);}/*** Encodes the passed object as a query string.** @param params An object to be encoded.* @returns An encoded query string. - Open: VersionChanges from v4 to v5+4-1import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";import { encodeQueryString } from "npm:@esri/arcgis-rest-request/dist/esm/utils/encode-query-string.js";import type { Context } from "npm:hono";
/** */export function authorize(options: IOAuth2Options,⦚ 22 unchanged lines ⦚import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";import { encodeQueryString } from "npm:@esri/arcgis-rest-request/dist/esm/utils/encode-query-string.js";import type { Context } from "npm:hono";/*** Copy of https://github.com/Esri/arcgis-rest-js/blob/bfd7ce977d9879077e92fabfc491240d8f230844/packages/arcgis-rest-request/src/ArcGISIdentityManager.ts#L760* for use with Hono instead of Express*/export function authorize(options: IOAuth2Options,⦚ 22 unchanged lines ⦚ - Open: VersionChanges from v3 to v4+1-5⦚ 25 unchanged lines ⦚const url = `${portal}/oauth2/authorize?${encodeQueryString(queryParams)}`;
response.writeHead(301, {Location: url,});response.end();}⦚ 25 unchanged lines ⦚const url = `${portal}/oauth2/authorize?${encodeQueryString(queryParams)}`;c.redirect(url);} - Open: VersionChanges from v2 to v3+1-0import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";
import type { Context } from "npm:hono";/** */⦚ 28 unchanged lines ⦚import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";import { encodeQueryString } from "npm:@esri/arcgis-rest-request/dist/esm/utils/encode-query-string.js";import type { Context } from "npm:hono";/** */⦚ 28 unchanged lines ⦚ - Open: VersionChanges from v1 to v2+23-26import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";import type { Context } from "npm:hono";
/****/export function authorize(options: IOAuth2Options,response: http.ServerResponse) {const { portal, clientId, expiration, redirectUri, state }: IOAuth2Options ={...{ portal: "https://arcgis.com/sharing/rest", expiration: 20160 },...options};const queryParams: any = {client_id: clientId,expiration,response_type: "code",redirect_uri: redirectUri};if (state) {queryParams.state = state;}const url = `${portal}/oauth2/authorize?${encodeQueryString(queryParams)}`;response.writeHead(301, {Location: url});response.end();}import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";import type { Context } from "npm:hono";/** */export function authorize(options: IOAuth2Options,c: Context,) {const { portal, clientId, expiration, redirectUri, state }: IOAuth2Options = {...{ portal: "https://arcgis.com/sharing/rest", expiration: 20160 },...options,};const queryParams: any = {client_id: clientId,expiration,response_type: "code",redirect_uri: redirectUri,};if (state) {queryParams.state = state;}const url = `${portal}/oauth2/authorize?${encodeQueryString(queryParams)}`;response.writeHead(301, {Location: url,});response.end();} - Open: VersionChanges from v0 to v1+35-0import type { IOAuth2Options } from "npm:@esri/arcgis-rest-request";import type { Context } from "npm:hono";/****/export function authorize(options: IOAuth2Options,response: http.ServerResponse) {const { portal, clientId, expiration, redirectUri, state }: IOAuth2Options ={...{ portal: "https://arcgis.com/sharing/rest", expiration: 20160 },...options};const queryParams: any = {client_id: clientId,expiration,response_type: "code",redirect_uri: redirectUri};if (state) {queryParams.state = state;}const url = `${portal}/oauth2/authorize?${encodeQueryString(queryParams)}`;response.writeHead(301, {Location: url});response.end();}
- Open: Version+0-0
Updated: October 31, 2024